package cn.fl.ref.fncpreabslim.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import fl.ref.fncpreabslim.dto.FncPreAbsLimDTO;
import cn.fl.ref.fncpreabslim.vo.FncPreAbsLimVO;

/**
 * 服务层与展现层转换类
 * 所有的PO只能在持久成和服务层使用
 * 所有的DTO只能在展现层和服务层使用
 * 在服务层中向下是DTO转PO,向上是PO转DTO
 */
public class FncPreAbsLimVOTransform {

	/**
	 * VO 转  DTO
	 * @param po
	 * @return
	 */
	public static FncPreAbsLimDTO toDTO(FncPreAbsLimVO vo) {
		FncPreAbsLimDTO  dto = null;
		if (vo != null) { 
			dto = new FncPreAbsLimDTO();
			dto.setId(vo.getId());
			
            dto.setInsId(vo.getInsId());  
   
            dto.setInsAccNoId(vo.getInsAccNoId());  
   
            dto.setAccNo(vo.getAccNo());  
   
            dto.setBatNo(vo.getBatNo());  
   
            dto.setPreLimAmt(vo.getPreLimAmt());  
   
            dto.setCurrLimAmt(vo.getCurrLimAmt());  
   
            dto.setIsDel(vo.getIsDel());  
   
            dto.setCrtTm(vo.getCrtTm());  
   
            dto.setCrtUsrId(vo.getCrtUsrId());  
   
            dto.setMdfTm(vo.getMdfTm());  
   
            dto.setMdfUsrId(vo.getMdfUsrId());  
            
            dto.setBuOrgCds(vo.getBuOrgCds());//可投放事业部
			dto.setPayNum(vo.getPayNum());//顺序
			dto.setBuOrgCdsNm(vo.getBuOrgCdsNm());
		}
		return dto;
	}

	/**
	 * DTO 转  PO
	 * @param dto
	 * @return
	 */
	public static FncPreAbsLimVO toVO(FncPreAbsLimDTO dto) {
		FncPreAbsLimVO vo = null;
		if (dto != null) {
			vo = new FncPreAbsLimVO();
			vo.setId(dto.getId());
            vo.setInsId(dto.getInsId());  
   
            vo.setInsAccNoId(dto.getInsAccNoId());  
   
            vo.setAccNo(dto.getAccNo());  
   
            vo.setBatNo(dto.getBatNo());  
   
            vo.setPreLimAmt(dto.getPreLimAmt());  
   
            vo.setCurrLimAmt(dto.getCurrLimAmt());  
   
            vo.setIsDel(dto.getIsDel());  
   
            vo.setCrtTm(dto.getCrtTm());  
   
            vo.setCrtUsrId(dto.getCrtUsrId());  
   
            vo.setMdfTm(dto.getMdfTm());  
   
            vo.setMdfUsrId(dto.getMdfUsrId());  
            vo.setBuOrgCds(dto.getBuOrgCds());//可投放事业部
			vo.setPayNum(dto.getPayNum());//顺序
			vo.setBuOrgCdsNm(dto.getBuOrgCdsNm());
		}
		return vo;
	}
	
	/**
	 * PO集合 转 DTO集合
	 * @param list
	 * @return
	 */
	public static List<FncPreAbsLimDTO> toDTOList(List<FncPreAbsLimVO> list) {
		List<FncPreAbsLimDTO>  voList = new ArrayList<FncPreAbsLimDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (FncPreAbsLimVO vo : list) {
				voList.add(toDTO(vo));
			}
		}
		return voList;
	}
	
	/**
	 * DTO集合 转 PO集合
	 * @param list
	 * @return
	 */
	public static List<FncPreAbsLimVO> toVOList(List<FncPreAbsLimDTO> list) {
		List<FncPreAbsLimVO>  voList = new ArrayList<FncPreAbsLimVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (FncPreAbsLimDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
}
